import { info } from "./url";

async function createQuestion(title, type, detail) {
  return uni.request({
    url: `${info.url}/question`,
    data: { title, type, detail },
    method: "POST"
  });
}

async function deleteQuestion(id) {
  return uni.request({
    url: `${info.url}/question/${id}`,
    method: "DELETE"
  });
}

async function changeQuestion(id, title, type, detail) {
  return uni.request({
    url: `${info.url}/question`,
    data: { id, title, type, detail },
    method: "PUT"
  });
}

async function getQuestion(id) {
  return uni.request({
    url: `${info.url}/question`,
    data: { id },
    method: "GET"
  });
}

async function getIdList(id){
  return uni.request({
    url:`${info.url}/question/getIdList?id=${id}`,
    method:"GET"
  })
}


export default { createQuestion, deleteQuestion, changeQuestion, getQuestion, getIdList };
